package org.to_zero.ssm.sdm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.to_zero.ssm.sdm.entity.Sign;
import org.to_zero.ssm.sdm.entity.vo.ResponseEntity;
import org.to_zero.ssm.sdm.service.SignService;

import java.util.List;

@RestController
@RequestMapping("/admin/sign")
public class SignController {

    @Autowired
    private SignService signService;

    @GetMapping("notSignList/{teamId}")
    public ResponseEntity notSignList(@PathVariable Integer teamId) {
        return signService.findNotSignList(teamId);
    }

    @PostMapping("signIn")
    public ResponseEntity signIn(@RequestBody List<Sign> signList) {
        return signService.saveSignList(signList);
    }

    @GetMapping("query")
    public ResponseEntity query(Sign sign) {
        return signService.findSignList(sign);
    }

    @PostMapping("update")
    public ResponseEntity update(@RequestBody Sign sign) {
        return signService.update(sign);
    }

    @DeleteMapping("delete/{id}")
    public ResponseEntity delete(@PathVariable Integer id) {
        return signService.deleteById(id);
    }

    @DeleteMapping("batchDelete/{ids}")
    public ResponseEntity batchDelete(@PathVariable Integer[] ids) {
        return signService.deleteByIds(ids);
    }
}
